Conversation
| - name: Check issue key | ||
| if: ${{ !steps.jira_key_from_title.outputs.issue_key }} | ||
| run: | | ||
| echo "Could not determine Jira issue from PR title" |
There was a problem hiding this comment.
Probably TODO: add exceptions for Dependabot etc PRs.
10650e3 to
4d59de0
Compare
sebhmg
left a comment
There was a problem hiding this comment.
see suggestion to merge workflows, and use a more specific pattern
There was a problem hiding this comment.
it might run too soon. Somehow, we want it executed after pr_add_jira_summary
Possibly just have "Check issue status" as an extra step in pr_add_jira_summary.
However, "Check issue status" must reran at every push (e.g. to error out when pushing to a closed issue).
My suggesting: merge the two workflow into one "Check Jira Status", with "Check JIRA issue status" step last:
- if trigger by
pull_request[opened], run all steps - if trigger is
pull_request[synchronize, reopened, ready_for_review], only run steps:- Find JIRA issue key from title
- Check JIRA issue status
Not finding JIRA from title is not an error.
Possible, use a secret to configure the pattern of supported key, e.g. "\b(NI|SHRUB|BEAST|AARG|SWALLOW|TIM|BRIDGE)[-# ]*([0-9]+)"
sebhmg
left a comment
There was a problem hiding this comment.
please, see questions and suggestions
| if: ${{ !steps.jira_key_from_title.outputs.issue_key }} | ||
| run: | | ||
| echo "Could not determine Jira issue from PR title" | ||
| exit 1 |
There was a problem hiding this comment.
suggestion: do not make it a failure. Skipping following steps with condition is enough
| if [ $? -ne 0 ]; then | ||
| echo "Jira API: error" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
suggestion: instead use set -e at the top of the script
although, it might be interesting to see the response. Will it show in stderror in any case?
| "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/${{ github.event.pull_request.number }}" | ||
| > /dev/null | ||
|
|
||
| check_jira_issue: |
There was a problem hiding this comment.
issue: upon PR opened, must ensure this jobs runs after add_jira_summary
So the JIRA issue number is in the title. Or use the same logic to fetch the jira issue: title plus branch name
There was a problem hiding this comment.
alternatively have a single job, where steps runs only upon opened, except for jira_key_from_title and "Check issue status" which also run
| - name: Find JIRA issue key from title | ||
| id: jira_key_from_title | ||
| if: ${{ !steps.jira_summary_from_branch.outputs.summary }} | ||
| env: | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| run: > | ||
| echo "issue_key=$( | ||
| echo $PR_TITLE | grep -osiE "^\s*\[?\s*$JIRA_PATTERN" | ||
| | head -n1 | sed -E "s/\W*$JIRA_PATTERN/\1-\2/i" | ||
| | tr [:lower:] [:upper:] | ||
| )" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
suggestion: make this a reusable action to use in both jobs
|
|
||
| - name: Find JIRA issue key from title | ||
| id: jira_key_from_title | ||
| if: ${{ !steps.jira_summary_from_branch.outputs.summary }} |
There was a problem hiding this comment.
issue: jira_summary_from_branch step does not exist in this workflow
07482e7 to
23cb0e6
Compare
aa29b27 to
e35cfc1
Compare
e35cfc1 to
866e558
Compare
DEVOPS-853 - Update Jenkinslib -- Jira API for querying issues is deprecated